package com.wannengbang.storemobile.homepage;


import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.google.gson.Gson;
import com.gyf.immersionbar.ImmersionBar;
import com.wannengbang.storemobile.R;
import com.wannengbang.storemobile.base.BaseActivity;
import com.wannengbang.storemobile.bean.UserInfoBean;
import com.wannengbang.storemobile.utils.SPManager;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class CashierSuccessActivity extends BaseActivity {

    @BindView(R.id.tv_merchant_name)
    TextView tvMerchantName;
    @BindView(R.id.tv_money)
    TextView tvMoney;
    @BindView(R.id.tv_commit)
    TextView tvCommit;
    private String money;
    private UserInfoBean userInfoBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        overridePendingTransition(R.anim.bottom_in, R.anim.bottom_silent);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cashier_success);
        ButterKnife.bind(this);
        ImmersionBar.with(this)
                .statusBarDarkFont(true)
                .navigationBarDarkIcon(true)
                .navigationBarColor(R.color.white)
                .statusBarDarkFont(true, 0.2f)
                .init();
        money = getIntent().getStringExtra("money");
        userInfoBean = new Gson().fromJson(SPManager.getInstance().getUserInfoJson(), UserInfoBean.class);
        if (userInfoBean != null) {
            tvMerchantName.setText(userInfoBean.getData().getName());
        }
        if (!TextUtils.isEmpty(money)) {
            tvMoney.setText(money);
        }
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(R.anim.bottom_silent, R.anim.bottom_out);
    }

    @OnClick(R.id.tv_commit)
    public void onViewClicked() {
        finish();
    }
}
